﻿using Autofac;
using FlyingEyeClient.ApplicationServices.SignalRHubs;
using WpfApp.MesServices;
using WpfApp.Uers;
using WpfApp.Update;
using WpfApp.ViewModels;
using WpfApp.Views;

namespace WpfApp
{
    public class WpfAppModule : Autofac.Module
    {
        protected override void Load(ContainerBuilder builder)
        {
            builder.RegisterType<UserManager>();
            builder.RegisterType<SignalRClientService>();
            builder.RegisterType<MainWindowViewModel>();
            builder.RegisterType<UserManagerWindow>();
            builder.RegisterType<TopTipWindow>();
            builder.RegisterType<UpdateService>().SingleInstance();
            builder.RegisterType<MainWindow>()
                .OnActivated(e => e.Instance.DataContext = e.Context.Resolve<MainWindowViewModel>());
            builder.RegisterType<MesConfigViewModel>();
            builder.RegisterType<MesConfigWindow>()
                .OnActivated(e => e.Instance.DataContext = e.Context.Resolve<MesConfigViewModel>());
            builder.RegisterType<InBoundMesService>();
        }
    }
}
